package com.manage.util;

import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;

public class TimeUtil {

	public static Timestamp parse(String time) throws ParseException {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		Timestamp a = null;
		if (StringUtil.notEmpty(time)) {
			try {
				a = new Timestamp(sdf.parse(time).getTime());
			} catch (ParseException e) {
				sdf = new SimpleDateFormat("yyyy-MM-dd");
				try {
					a = new Timestamp(sdf.parse(time).getTime());
				} catch (ParseException e1) {
					throw e1;
				}
			}
		}
		return a;
	}

}
